Release 10.1A: OpenEdge Development:
Progress 4GL Handbook


Using shorthand syntax for dynamic field and table references

As you might have noticed in the previous section, the syntax for referring to dynamic fields and tables within a temp-table (or dynamic ProDataSet, query, or buffer) is cumbersome. For example, when you want to refer to the CustNum field of the ttCustomer table through a temp-table handle, you must type out this long line of code:

hTT:DEFAULT-BUFFER-HANDLE:BUFFER-FIELD(“CustNum”):BUFFER-VALUE 

Starting with OpenEdge Release 10.1A, there is an alternative shorthand syntax that you can use that can makes writing dynamic references to fields and tables easier. You can use this shorthand syntax when the field or table name you are referencing is known at compile time:

container-handle::named-member 

Where container-handle is a temp-table, ProDataSet, or buffer handle and named-member is the name of a member of the container. If the container is a temp-table, then the named-member must be a field in the temp-table and the value of that field in the default buffer for the temp-table is returned. If the container is a ProDataSet, then the named-member must be the name of a buffer in the ProDataSet and that buffer’s handle is returned. If the container is a buffer, then the named-member must be a field in the buffer and the value of that field in the buffer is returned.

As an example, if the CustNum field is known at compile time, you can instead type the following code to reference the CustNum field of the ttCustomer table through a temp-table handle:

hTT::CustNum 

The shorthand syntax uses a double colon (::) for the delimiter between the two character strings to help avoid confusion with variables, text strings, as well as static references to database tables and fields. Table 20–1 describes the rules that determine which type of delimiter to use between two character strings.

Table 20–1: Rules for delimiter use between character strings
If the left-side character string is . . .
If the right-side character string is . . .
Use this delimiter
Examples
All of the following:
  • The actual name of a database or table.
  • Known at compile time.
  • Not a handle.
A member of the left-side handle.
A period (.).
Customer.CustNum 
Sports.Customer 
Sports.Customer.CustNum 
A handle (not the actual name of a database or table).
An attribute or method for the left-side handle.
A colon (:).
hBuff:NUM-FIELDS 
hDset:NUM-BUFFERS 
hBuff:FIND-FIRST() 
A handle to a container object (buffer, table, or ProDataSet).
Not an attribute or method, but is instead a named member of the left-side handle which is known at compile time.
A double colon (::).
hBuff::CustNum 
hDset::Customer 
hDSet::Customer::CustNum 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095